# [prefix-q] 展示窗口数字并选择跳转
# bind-key q display-panes
# bind-key a last-pane # 绑什么好?

# -------------------------------- pane end --------------------------------

# -------------------------------- move/copy/paste begin --------------------------------
# use vi mode
# vi is good  把 Tmux 设为 vi 模式，使其与 Vim 的操作更加接近
setw -g mode-keys vi

# [ 进入复制，space键开始选择问题  方向键移动， / 回车复制  / ] 黏贴
bind-key [ copy-mode
bind-key ] paste-buffer

# Copy and paste like in vim
# p 换成paste
unbind p
bind p paste-buffer

# the following vi-copy bindings match my vim settings
#   see https://github.com/gpakosz/.vim.git
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle

bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi Escape send-keys -X cancel
bind-key -T copy-mode-vi H send-keys -X start-of-line
bind-key -T copy-mode-vi L send-keys -X end-of-line

# Update default binding of `Enter` to also use copy-pipe
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"

# for osx
# Enable native Mac OS X copy/paste  对于mac用户，可以复制到系统剪贴板
set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
# -------------------------------- move/copy/paste end --------------------------------

# -------------------------------- mouse begin --------------------------------
# mouse behavior
# Using set -gq instead of set -g will silence the unknown option error, while still setting it on old versions of tmux
setw -gq mode-mouse on
set -gq mouse-select-pane on
set -gq mouse-resize-pane on
set -gq mouse-select-window on
set -g mouse on
# -------------------------------- mouse end --------------------------------

# -------------------------------- status line begin  --------------------------------
# 颜色
set-option -g status-bg black
set-option -g status-fg white

set -g status-bg '#4e4e4e'
set -g status-fg '#bbbbbb'
# set -g status-left-fg '#bbbbbb'
# set -g status-left-bg '#4e4e4e'
# set -g status-right-fg '#bbbbbb'
# set -g status-right-bg '#4e4e4e'

set -g status-left-length 90
set -g status-right-length 60

# 对齐方式
set-option -g status-justify centre

# 左下角
# set-option -g status-left '#[bg=black,fg=green][#[fg=cyan]#S#[fg=green]]'
set-option -g status-left "S-#S:W-#I:P-#P"

# 窗口列表
setw -g automatic-rename on
# set-window-option -g window-status-current-fg magenta
set-window-option -g window-status-format '#[dim]#I:#[dim]#W#[fg=grey,dim]'
set-window-option -g window-status-current-format '[#[fg=white,bold]#I#[fg=white,bold]:#[fg=white,bold]#W#[fg=dim]]'


# 右下角
set -g status-right '#[fg=green][#[fg=white]%m-%d %H:%M#[fg=green]]'


# -------------------------------- status line end --------------------------------
# -------------------------------- color begin --------------------------------

# pane border colors
# set-option -g pane-active-border-fg '#55ff55'
# set-option -g pane-border-fg '#555555'
# set -g pane-border-fg colour245
# set -g pane-active-border-fg colour39

# -------------------------------- color end --------------------------------

#--------------------------- base config end -------------------------------

# set default shell
# set -g default-command /usr/bin/zsh
# set -g default-shell /usr/bin/zsh
set -g default-terminal "xterm-256color"
